/**
 * @读取一行数据
 *
 * @author	 wangshikun <wangshikun2010@gmail.com>
 * @copyright	(c) 2012 wangshikun <wangshikun2010@gmail.com>
 * @license	http://www.opensource.org/licenses/mit-license.php The MIT License
 * @package	default
 * @subpackage	default
 */

#include <stdio.h>
#include <cs50.h>
void readline(char line[]);

int main(int argc, char *argv[]) {
	char line[81];

	printf("输入语句的行数：");
	int n = GetInt();

	printf("\n");

	for (int i=0; i<n; i++) {
		printf("请输入%d行字符串：", i + 1);
		readline(line);
		printf("%s\n\n", line);
	}

	return 0;
}

void readline(char line[]) {
	int i = 0;
	char text;

	do {
		text = getchar();
		line[i] = text;
		i++;
	} while (text != '\n');

	line[i - 1] = '\0';
}

